<!-- create 'photo' slot -->
<?php if ($user->hasAttribute('photo')): ?>
    <?php slot('photo') ?>
    <img src="<?php echo $user->getAttribute('photo'); ?>" width="105px">
    <?php end_slot(); ?>
<?php endif; ?>

<!-- create 'user_name' slot -->
<?php slot('user_name') ?>
<div id="layout_user_name">
    <?php echo $full_name; ?>
</div>
<?php end_slot(); ?>

<?php
$time_step = sfConfig::get('app_LoginzaPlugin_chat_time_step_msec');
$now = time();
?>
<div id="authtorized_user_div"
     id_user="<?php echo $user->getAttribute('id'); ?>" 
     full_name="<?php echo $full_name; ?>"
     id_user_provider="<?php echo $user->getAttribute('id_user_provider'); ?>"
     style="display: none"
     ></div>

<div id="chat_time_step"
     msec="<?php echo $time_step; ?>"
     style="display: none"
     ></div>

<!-- this is facebook's 'Like' -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/ru_RU/all.js#xfbml=1";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!-- end 'fbLike' -->

<div id="chat_window">
    <div id="chat_dialogs">

    </div>
    <div id="chat_msgs_sendpanel">
        <div id="msgs_panel">
        </div>
        <div id="empty_div"></div>
        <div id="send_panel">
            <div>
                <textarea id="user_msg_text" rows="2"></textarea>
            </div>
            <div style="margin-top: 4px;">
                <input id="sendMsgBtn" type="button" value="send" onclick='alert("Please, choose user!");'>
            </div>
        </div>
    </div>
    <div id="all_users">
        <?php foreach ($users as $usr): ?>
            <?php
            $user_provider = $usr->getLzUserProvider();
            if($user_provider->getFirstName() != null){
                $user_name = $user_provider->getFirstName() . ' ' . $user_provider->getLastName();
            }else if($user_provider->getNick() != null){
                $user_name = $user_provider->getNick();
            }else if($user_provider->getEmail() != null){
                $user_name = $user_provider->getEmail();
            }else{
                $user_name = $user_provider->getIdentity();
            }
            $expires_at = $usr->getExpiresAt();
            $status = '';
            if (time() < $expires_at)
                $status = '<small>online</small>';
            ?>
            <div class="choose_user"
                 id_user="<?php echo $usr->getId(); ?>"
                 id_user_provider="<?php echo $usr->getIdUserProvider(); ?>"
                 onclick="addUserToDialog(this);"
                 user_name="<?php echo $user_name ?>"
                 >
                     <?php
                     echo $user_name;
                     ?>

                <div id="<?php echo 'status' . $usr->getId(); ?>"
                     class="<?php if ($usr->getExpiresAt() > $now) echo 'status_on'; else echo 'status_off'; ?>"
                     ></div>
            </div>
        <?php endforeach; ?>
    </div>
</div>
<br>
<!-- div for Facebook's 'Like' -->
<div class="fb-like" data-href="<?php echo sfConfig::get('app_LoginzaProvider_my_host') . '/chat'; ?>" data-send="true" data-width="450" data-show-faces="true"></div>